<template>
    <div>
        <!-- 气泡弹窗 -->
        <div id="popup" class="ol-popup">
            <div id="popup-content">
                <div class="headerTitle">
                    <div class="text">
                        {{popupData.ertName}}
                    </div>
                </div>
                <div class="popup-select">
                    <el-radio-group v-model="tabPosition" >
                        <el-radio-button class="button-select" label="attribute">属性</el-radio-button>
                        <el-radio-button class="button-select" label="dataList">数据列表</el-radio-button>
                    </el-radio-group>
                </div>
                <div class="tableList">
                    <ul class="list-group list-group-striped" v-if="tabPosition=='attribute'">
                        <li class="popup-group-item">
                            <label>侧线名称:</label>
                            <div class="pull-left">{{ popupData.ertName}}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>长度:</label>
                            <div class="pull-left">{{ popupData.ertLength }}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>电极数:</label>
                            <div class="pull-left">{{ popupData.electrodeNum }}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>电极间距:</label>
                            <div class="pull-left">{{ popupData.electrodeSpace }}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>仪器:</label>
                            <div class="pull-left">{{ popupData.instrument }}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>操作人:</label>
                            <div class="pull-left">{{ popupData.operator }}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>审核人:</label>
                            <div class="pull-left">{{  popupData.checher}}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>创建人:</label>
                            <div class="pull-left">{{  popupData.createBy}}</div>
                        </li>
                        <li class="popup-group-item">
                            <label>创建时间:</label>
                            <div class="pull-left">{{  popupData.createTime}}</div>
                        </li>
                    </ul>
                    <el-table
                    v-else
                        :data="tableData"
                        style="width: 100%">
                        <el-table-column
                        type="index"
                        width="80">
                        </el-table-column>
                        <el-table-column
                            prop="ertName"
                            label="文件名"
                            width="150">
                        </el-table-column>
                        <el-table-column
                        label="操作"
                        align="center"
                        class-name="small-padding"
                    >
                        <template slot-scope="scope">
                            <el-button
                                size="medium"
                                type="text"
                                @click.stop="handleDetail(scope.row)"
                            >详情</el-button>
                        </template>
                    </el-table-column> 
                    </el-table>
                </div>
            </div>
            <div class="ol-popup-closer" @click="closePopup"></div>
            <div id="popup-detail" class="popup-detail">
                <!-- <el-button @click.stop="cancel">取消</el-button> -->
                <el-button @click.stop="showImage()" type="primary">查看反演图</el-button>
            </div>
        </div>        
    </div>
</template>

<script>
import {getListByErtInfoId} from "@/api/data/proDataForup"
export default {
    name: 'popup',
    data() {
        return {
            tabPosition:"attribute",
            // 数据列表
            tableData:[]
        };
    },
    mounted() {
        
    },
    computed: {
        popupData() {
            return this.$store.getters.popupData;　　//需要监听的地图点击数据
        }
        },
    watch:{
        popupData(val){
            if(val){
                this.tabPosition="attribute"
                this.getPopupList()
                }
            } 
    },
    methods: {
        // 查看反演图
        showImage(){
            this.$router.push({ name:'ERTImage',params:this.popupData});
        },
        //获取数据列表
        getPopupList(){
            if(this.popupData.ertInfoId){
                let reqData = {
                    ertInfoId:this.popupData.ertInfoId
                }
                getListByErtInfoId(reqData).then(res=>{
                    this.tableData = res.data
                })
            }
            
        },
       
        // 取消按钮
        cancel(){

        },
        //ERT跳转详情页
        handleDetail(row){
            // debugger
            let data = {
                Id:row.ertId,
                dataType:"ERT"
            }
            this.$router.push({ name:'Table',query:data,params:row});
        },
        //反演图
        handleImage(row){
            
        },
        //关闭弹窗
        closePopup(){
            this.$emit('close');
        }
    },
};
</script>

<style  scoped lang="scss">
/* 弹出气泡样式 */
.ol-popup {
position: absolute;
background-color: white;
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
/* padding: 5px; */
border-radius: 5px;
/* overflow: hidden; */
/* border: 1px solid #cccccc; */
min-width: 380px;
height: 470px;
display: none;
}
#popup-content{
    overflow: hidden;
    border-bottom:1px solid #EDEFF4 ;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;

margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 10px;
right: 8px;
}
.ol-popup-closer:after {
cursor: pointer;
content: "✖";
}
.popup-group-item{
    border: none;
    padding: 2px 0px;
}
.popup-group-item label{
    margin-left:5px;
    display: inline-block;
    width: 30%;
    text-align: left;
    white-space: nowrap;
    // font-weight: 500;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 13px;
}
.popup-group-item .pull-left{
    margin-left: 3%;
    display: inline-block;
    text-align: left;
    width: 62%;
    color: #222222;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 13px;
}
.popup-detail{
    display: flex;
    justify-content: center;
    margin-top: 15px;
}
.show-tetial{
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
}
.headerTitle{
    height: 41px;
    width: 100%;
    background: #DADDE9;
    color: #000;
    .text{
        width: 100%;
        height: 18px;
        padding-left: 20px;
        font-size: 14px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #000;
        line-height: 50px;
    }
}
.popup-select{
    width: 100%;
    display: flex;
    // justify-content: center;
    padding: 0px 27px;
    // height: 32px;
    .button-select{
        margin: 16px 0px;
        width: 180px;
        padding:8px auto;
        /deep/ .el-radio-button__inner{
            width: 180px;
        }
        /deep/ .el-radio-button__inner{
            padding-top:8px;
            padding-bottom:8px;
        }
    }
    /deep/ .el-radio-button__inner:hover{
        color: #3066FF !important;
    }
}
.tableList{
    padding: 0px 27px;
    height: 280px;
    overflow:auto;
    scrollbar-width: none; /* firefox */
    -ms-overflow-style: none; /* IE 10+ */
    /deep/ th{
        background: #F1F2F5;
    }
    /deep/ th{
        padding: 0px 0px !important;
    }
    /deep/ .el-table td{
        padding: 0px 0px !important;
    }
    .list-group{
        padding-top:0px !important;
    }
}
.tableList::-webkit-scrollbar {
        display: none; /* Chrome Safari */
        }
</style> 